package com.huishi.entity.message;

import lombok.Getter;

import java.sql.ResultSet;

/**
 * 表同步元数据信息
 * 源数据
 */
@Getter
public class DBMsg {

    private ResultSet resultSet; // 结果集

    private int columnCount; // 字段总数

    private StringBuilder placeholders; // 同步SQL占位符


    public void setResultSet(ResultSet resultSet) {
        this.resultSet = resultSet;
    }

    public void setColumnCount(int columnCount) {
        this.columnCount = columnCount;
        this.placeholders = new StringBuilder();
        for (int i = 0; i < columnCount; i++) {
            placeholders.append("?");
            if (i < columnCount - 1) {
                placeholders.append(", ");
            }
        }
    }

}
